<!-- S search -->
<app-search-bar
  [submitLoading]="tableParams.loading"
  [searchOptions]="searchOptions"
  labelFlex="80px"
  (onSearch)="queryResetData($event)"
  (onReset)="queryResetData($event)"
>
</app-search-bar>
<!-- E search -->

<nz-card class="m-t-4">
  <div class="opera-wrap">
    <button
      nz-button
      nzType="primary"
      [nzLoading]="exportLoading"
      (click)="exportTable()"
    >
      <i nz-icon nzType="download" nzTheme="outline"></i>导出
    </button>
  </div>

  <div class="pagination-wrap-position p-t-10">
    <nz-table
      #basicTable
      nzSize="small"
      nzShowSizeChanger
      nzShowQuickJumper
      nzOuterBordered
      [nzFrontPagination]="false"
      [nzLoadingDelay]="100"
      [nzLoading]="tableParams.loading"
      [nzData]="tableParams.tableData"
      [nzPageSizeOptions]="[5, 10, 20, 50, 100]"
      [nzTotal]="tableParams.total"
      [nzPageIndex]="tableParams.page"
      [nzPageSize]="tableParams.pageSize"
      [nzShowTotal]="totalTemplate"
      (nzPageIndexChange)="onPageIndexChange($event)"
      (nzPageSizeChange)="onPageSizeChange($event)"
    >
      <thead>
        <tr>
          <th nzAlign="center">售后申请日期</th>
          <th nzAlign="center">订单号</th>
          <th nzAlign="center">状态</th>
          <th nzAlign="center">售后退款时间</th>
          <th nzAlign="center">退款金额</th>
          <th nzAlign="center">退款爱豆</th>
          <th nzAlign="center">退款平台</th>
          <th nzAlign="center">交易流水</th>
        </tr>
      </thead>

      <tbody>
        <tr *ngFor="let data of basicTable.data; let index = index;">
          <!-- 售后申请日期 -->
          <td nzAlign="center">{{ data.createTime || '-' }}</td>
          <!-- 订单号 -->
          <td nzAlign="center">{{ data.orderNum || '-' }}</td>
          <!-- 状态 -->
          <td nzAlign="center">售后成功</td>
          <!-- 售后退款时间 -->
          <td nzAlign="center">{{ data.refundTime || '-' }}</td>
          <!-- 退款金额 -->
          <td nzAlign="center">{{ data.refundPrice || '0' }}</td>
          <!-- 退款爱豆 -->
          <td nzAlign="center">{{ data.refundAiDouAmount || '0' }}</td>
          <!-- 退款平台 -->
          <td nzAlign="center">{{ data.refundType | refundPlatformType }}</td>
          <!-- 交易流水 -->
          <td nzAlign="center">{{ data?.payOrderNum || '-' }}</td>
        </tr>
      </tbody>
    </nz-table>

    <!-- 分页template -->
    <ng-template #totalTemplate let-total>共有 {{ total }} 条</ng-template>
  </div>
</nz-card>